package com.sky.controller.user;

import com.sky.constant.CahceVlueConstant;
import com.sky.entity.Setmeal;
import com.sky.result.Result;
import com.sky.service.SetmealService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 套餐管理
 */
@RestController
@RequestMapping("/user/setmeal")
@Api(tags = "套餐相关接口")
@Slf4j
public class UserSetmealController {

    @Autowired
    private SetmealService setmealService;

    @GetMapping("/list")
    @Cacheable(value = CahceVlueConstant.SETMEAL_CAHCE_VALUE,key = "#categoryId")// setmealCahce::13
    public Result<List<Setmeal>> list(@RequestParam Long categoryId){
        List<Setmeal> list=setmealService.getListByCtgId(categoryId);
        return Result.success(list);
    }


}

